import argparse
import os

from model.powerModel.Pixel import Pixel


def parse_args():
    # 解析输入参数
    parser = argparse.ArgumentParser(
        description='Tools for analyse battery consume',
    )
    parser.add_argument('--mode', default="ALONE")
    parser.add_argument('--path', default="batteryStats/Pixel/Expriment/replay/v0.1")
    parser.add_argument('--brand', default="pixel")
    args = parser.parse_args()

    return args

if __name__ == '__main__':
    # policy = "findBug"
    args = parse_args()
    mode = args.mode
    if mode == "ALONE":
        dataPath = args.path
        for file_name in os.listdir(dataPath):
            print(file_name + ": ")
            battery = Pixel(os.path.join(dataPath, file_name))
            battery.print_drain()
            battery.print_hardware()
    else:
        # 可选参数flight 、 wifi 、lte
        network_pattern = "wifi"
        # fullAlign对应完整的预测模块，align对应部分预测模块，paper对应对比论文，origin对应原生
        strategies_list = ["fullAlign","fullAlign","paper","origin"]
        data_path = "data/batteryStats/oppo/v0.1/lazy"

        # 将batterystats的txt文件放入下列路径中
        fullAlign_path = os.path.join(data_path, network_pattern, strategies_list[0])
        align_path = os.path.join(data_path, network_pattern, strategies_list[1])
        paper_path = os.path.join(data_path, network_pattern, strategies_list[2])
        origin_path = os.path.join(data_path, network_pattern, strategies_list[3])
        # align_path = "batteryStats/fullAlign"
        # origin_path = "batteryStats/origin"

        strtegies_path = [fullAlign_path,align_path,paper_path,origin_path]



        for i in range(len(strategies_list)):
            print(strategies_list[i])
            for file_name in os.listdir(strtegies_path[i]):
                print(file_name + ": ")